/**
 * 重定向到手机端，因为只破解了手机端限制复制的js，pc端的js太复杂懒得搞了
 */
chrome.webRequest.onBeforeSendHeaders.addListener(
    function(info) {
        // if(true){
            for (var i = 0; i < info.requestHeaders.length; ++i) {
                if (info.requestHeaders[i].name === 'User-Agent') {
                    // if (localStorage.changeuseragent) {

                    !function(i) {
                        info.requestHeaders[i].value = "Mozilla/5.0 (Linux; Android 5.1.1; OPPO A33m Build/LMY47V) AppleWebkit/537.36 (KHTML,like Gecko) Chrome/57.0.2987.132 Mobile Safari/537.36";
                    }(i)
                    // }
                    break;
                }
            }
            return {
                "requestHeaders": info.requestHeaders
            };
        // }

    },
    {
        urls: [
            // "<all_urls>" //"https://wenku.baidu.com/view/*"
            "*://*.baidu.com/view/*"
        ],
    },
    ["blocking", "requestHeaders"]);
